<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>车辆价签</title>
    <meta http-equiv="X-UA-Compatible" content="ie=edge,ie=11,chrome=1" />
    <link rel="stylesheet" type="text/css" href="../css/price.css">
    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/config.js"></script>
    <script type="text/javascript" src="../js/filter.js"></script>
    <script type="text/javascript" src="../js/qrcode.js"></script>
  </head>
<body >
<div id="appPrices">
        <div class="price-bottoms prints3-header"><div class="bom-img"><img class="logos" src="../images/bom-logo.png" alt=""> <img class="long-img logo-title" src="../images/qwx.png"></div></div>
        <div style="width: 100%;height: 4px;background: #E16725"></div>
        <div class="price-logos">
            <img class="logo" src="../images/xa.png" v-if="res.marketId == 139">
            <img class="logo" src="../images/ss.png" v-else-if="res.marketId == 143">
            <img class="logo" src="../images/wf.png" v-else-if="res.marketId == 144">
            <img class="logo" src="../images/ts.png" v-else-if="res.marketId == 145">
            <img class="logo" src="../images/qy-logo.png" v-else>
            <dl>
                <dt class="put-logo" >
                    <!-- <img  alt=""> -->
                </dt>
                <dd>{{res.shop.shopName  || ''}}</dd>
            </dl>
        </div>
        <div class="prices-titles"><span><span class="auth" v-if="res.carAuthState == 10"><img src="../images/auth.png" /></span>{{res.brand.brandName || ''}} {{res.model.modelName || ''}}</span></div>
        <div class="price-table price2-table">
            <div class="price-detials price2-detials">
                <p>
                    <span class="b-left">上牌时间：<a v-if="res.carLicenceDate">{{res.carLicenceDate | filterGetDate}}</a><a v-else="res.carLicenceDate">暂无</a></span>
                    <span class="b-right">排量：<a v-if="res.carDisplacement">{{res.carDisplacement + res.carInletModel}}</a><a v-else="res.carDisplacement">暂无</a></span>
                </p>
                <p>
                    <span class="b-left">表显里程：<a v-if="res.carMileage">{{res.carMileage}}万公里</a><a v-else="res.carMileage">暂无</a></span>
                    <span class="b-right">变速箱：{{res.carGearbox || '-'}}</span>
                </p>
                <p>
                    <span class="b-left">排放标准：{{res.carEnviron || '-'}}</span>
                    <span class="b-right">车身颜色：{{res.carOutColor || '-'}}</span>
                </p>
                <p>
                    <span class="b-left">交强险到期日：<a v-if="res.carForceInsuranceDate">{{res.carForceInsuranceDate | filterGetDate}}</a><a v-else="res.carForceInsuranceDate">暂无</a></span>
                    <span class="b-right">年检到期日：{{res.carValidateDate | filterGetDate}}</span>
                </p>
            </div>
        </div>
        <div style="width: 100%;height: 24px;background: #B5B6B6; margin-top: 53px"></div>
        <div class="price-prices3">
            <div class="price-mid1">
                <!-- <span class="v-fonts">预售价</span> -->
                <span class="v-fonts3">售价</span>
                <span class="new-price1" v-if="res.carGuidePrice && res.carRetailPrice && res.carRetailPrice >= 0">新车含税价：{{newPrice}}万元，省{{salePrice}}万元</span>
                <span class="price-nums change-price" style="height: 150px;padding-top: 60px;padding-right: 0" v-if="res.carRetailPrice && res.carRetailPrice >= 0"><span style="font-size:130px;">￥</span>{{res.carRetailPrice}}<span style="margin-left: 35px;">万元</span></span>
                <span class="price-nums face" style="font-size:150px;line-height:280px;" v-else="res.carRetailPrice && res.carRetailPrice >= 0">面议</span>
            </div>
        </div>
        <div class="car-remark">
            <div class="qr-tip1" v-if="res.carFinanceService && res.carFinanceService == 1">首付最低20%</div>
            <div class="qr-tip1" v-if="res.car4sUpkeepState && res.car4sUpkeepState == 1" >4S店定期保养</div>
        </div>
        <div class="cars-conf">
            <div class="cars-conf-one clearfix" style="margin-bottom: 70px" v-if="confList.length > 0">
                <label>车辆配置：</label>
                <div class="conf-list" >
                    <span class="conf-item" v-for="item in confList" >{{item}}</span>
                </div>
            </div>
            <div class="cars-conf-two clearfix" v-if="res.carSellingPointDesc" style="width: 870px;overflow: hidden">
                <label style="height:50px">车辆描述：</label>
                <div class="car-infor">{{res.carSellingPointDesc}}</div>
            </div>
        </div>

        <div class="car-qrcode3">
            <dl class="car-num3">
                <dt id="right-code">
                    <div class="qylogo-two">
                        <img src="https://erp.anpxd.com/cars/images/logo.jpg">
                    </div>
                </dt>
                <dd>扫一扫，查看车辆详情</dd>
            </dl>
        </div>
        <div class="user-url3" style="width: 100%">
            <p class="user-mobiles3"><img src="../images/price-tel2.png" />{{res.user.userName}}：{{res.user.userMobile || "暂无"}}</p>
        </div>
    <div id="printBtnGroup">
        <div class="item-btn" onclick="turnToPricetTag2()">价签样式一</div>
        <div class="item-btn" onclick="turnToPricetTag1()">价签样式二</div>
        <div class="item-btn" id="thisPrintBtn" onclick="printPriceTag()">打印价签</div>
    </div>

</div>
</body>
  <script type="text/javascript">
    if (GetQueryString('hideBtn')) {
      $('#thisPrintBtn').hide();
    }
    var pricetag = new Vue({
      el:'#appPrices',
      data: {
        res: {
            model:{},
            brand:{},
            series:{},
            shop:{},
            user:{},
        },
        carConfs: '',
        carConf: ["氙气大灯", "GPS导航", "电动车窗", "真皮座椅", "定速巡航"],
        bright: ["全程4S店维修保养", "包过户", "旧车换新车", "以租代购", "延保服务(1年/2万公里)"],
        isAdd: false,
        chose: [],
        noChose: [],
        carConfList:[],
        confList:[],
        ind: ''
      },
      computed:{
        newPrice(){
          return (this.res.carGuidePrice + (this.res.carGuidePrice/1.17 * 0.1)).toFixed(2)
        },
        salePrice(){
           return (this.newPrice - this.res.carRetailPrice).toFixed(2)
        }
      },
    });

    // $.ajax({
    //   type: "get",      //data 传送数据类型。post 传递
    //   dataType: 'json',  // 返回数据的数据类型json
    //   url: defaultUrl+"/controller/getCarById",  // yii 控制器/方法
    //   cache: false,
    //   data: {'carId': carId},  //传送的数据
    //   error:function(){
    //     alert("数据传输错误");
    //   },success: function (data) {
    //     console.log(data);
    //     if (data.code != 1) {
    //       return false
    //     }
    //     pricetag.res = data.result;
    //
    //   }
    // });
    $.ajax({
        type: "get",      //data 传送数据类型。post 传递
        dataType: 'json',  // 返回数据的数据类型json
        url: defaultUrl+"/controller/getPrintCarInfo",  // yii 控制器/方法
        cache: false,
        data: {'carId': carId},  //传送的数据
        error:function(){
            alert("数据传输错误");
        },success: function (data) {
            if (data.code == 1) {
                pricetag.res = data.result.car;
                setQrCode(data.result.car);
                if (data.result.carConfInfoStr != '') {

                    pricetag.confList = data.result.carConfInfoStr.split('，').slice(0,10);
                }
            }else if (data.code == 2) {
                if (data.result.code = 2) {
                    pricetag.res = data.result.car;
                    setQrCode(data.result.car);
                    if (data.result.carConfInfoStr != '') {
                        pricetag.confList = data.result.carConfInfoStr.split('，').slice(0,10);
                    }
                }
            }else{
                return false;
            }
        }
    });

    $.ajax({
        type: "get",      //data 传送数据类型。post 传递
        dataType: 'json',  // 返回数据的数据类型json
        url: defaultUrl+"/controller/getCarConfById",  // yii 控制器/方法
        cache: false,
        data: {'carId': carId},  //传送的数据
        error:function(){
            alert("数据传输错误");
        },success: function (data) {
            console.log(data);
            if (data.code != 1) {
                return false
            }
            for (var i = 0; i < data.result.length; i++) {
                for (var j = 0; j < data.result[i].childCarConf.length; j++) {
                    if (data.result[i].childCarConf[j].selectedState) {
                        pricetag.carConfList.push(data.result[i].childCarConf[j].confName);
                    }
                }
            }
        }
    });
    function setQrCode(res){
        var rightCode = new QRCode(document.getElementById("right-code"), {
            width : 160,//设置宽高
            height : 160
        });
        rightCode.makeCode(window.location.origin+'/wx-web/controller/wx/toWxOpenOauth2?action=carDetail&state='+pricetag.res.carId+'&marketId='+pricetag.res.marketId);
    }
    window.onload =function(){

        // var wxCode = new QRCode(document.getElementById("wx-code"), {
        //   width : 150,//设置宽高
        //   height : 150
        // });

    }
    function printPriceTag(){
      document.getElementById('printBtnGroup').style.display = "none";
      window.print();
      document.getElementById('printBtnGroup').style.display = "block";
    }
    function turnToPricetTag1(){
      window.location.href = "pricetag2.html"+ window.location.search
    }
    function turnToPricetTag2(){
      window.location.href = "pricetag.html"+ window.location.search
    }


  </script>
</html>


































